##The spatial and temporal variables for the 1D model(spatial variable in the axial direction)

from casadi import *

def spatialVariables_1D():
    totalDepth      = 0.50   # in meters ('m')
    axialNodes      = 26
    axialDistance   = totalDepth/(axialNodes-1)
    totalNodes      = axialNodes
    totalStates     = totalNodes
    dimenProcNoise  = totalStates

    return totalDepth, axialNodes, axialDistance, totalNodes



# def temporalVariable():
#     samplingTime   = 2*60*60
#     samplingTimeInternal = 1*6*60
#     simulationTime = 25000*60*60
#     internalTimeSteps = int(samplingTime/samplingTimeInternal)
#     totTimeSteps   = int(simulationTime/samplingTime)
#     return samplingTime, samplingTimeInternal, internalTimeSteps, totTimeSteps


def temporalVariable():
    samplingTime   = 1*6*60
    samplingTimeInternal = 1*6*60
    #simulationTime = 7*6*4*60*60
    simulationTime = 15*24*60*60
    internalTimeSteps = int(samplingTime/samplingTimeInternal)
    totTimeSteps   = int(simulationTime/samplingTime)
    return samplingTime, samplingTimeInternal, internalTimeSteps, totTimeSteps



def temporalVariable_dataGen(final_time):
    samplingTime   = 2*60*60
    samplingTimeInternal = 1*6*60
    #simulationTime = *6*4*60*60
    simulationTime = final_time
    internalTimeSteps = int(samplingTime/samplingTimeInternal)
    totTimeSteps   = int(simulationTime/samplingTime)
    return samplingTime, samplingTimeInternal, internalTimeSteps, totTimeSteps


def CMatrixAllMeasurements(totalStates):
    CMatrixAll = DM.eye(totalStates)
    return CMatrixAll



def loamySoil():
    soilPars={}
    soilPars['thetaR'] = 0.078
    soilPars['thetaS'] = 0.43
    soilPars['alpha']  = 3.6
    soilPars['n']      = 1.56
    soilPars['m']      = 1-1/soilPars['n']
    soilPars['Ks']     = 0.00000288889
    soilPars['neta']   = 0.5
    soilPars['Ss']     = 0.00001

    return soilPars


def generatingCoordinates_1D(axialNodes):
    #Coordinates are used to identify each node present in the mesh
    coordinates=[]
    for k in range(axialNodes):
        y=[0,0,k]
        coordinates.append(y)            
    return coordinates